/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.progin.drop.server;

import com.progin.drop.core.*;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author HP
 */
public class Main {
    public static String basedir = "";

    public static void main(String[] args) {
        if (args.length == 0)
            Main.basedir = "E:/xampp/htdocs/progin-1/tugas2/public/files";
        else
            Main.basedir = args[0];

        try {
            Socket sock;
            ServerSocket service = new ServerSocket(2000);

            while (true) {
                sock = service.accept();
                System.out.println("Incoming transmission from : " + sock.getInetAddress() + ":" + sock.getPort());

                new Thread(new Worker(sock)).start();
            }
        } catch (IOException ex) {
            Logger.getLogger(TestMain.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
        }
    }

}
